#include <lib/std.mi>
#include "attribs.m"

System.onScriptLoaded() {
	initAttribs();
	menubar_ml_attrib.onDataChanged();
}

menubar_ml_attrib.onDataChanged() {

	Group Player = getscriptgroup().findobject("player.content.ml.dummy.group");
	Group MenuBar = getscriptgroup().findobject("wasabi.menubar.ml");
	Layout main = getscriptgroup().getParentLayout();

	main.beforeRedock();
	if (getData() == "1") {
		Player.setXmlParam("y","17");
		MenuBar.show();
		main.snapAdjust(0,0,0,0);
	} else {
		Player.setXmlParam("y","0");
		MenuBar.hide();
		main.snapAdjust(0,0,0,17);
	}
	main.Redock();
}

System.onKeyDown(String k) {
  if (menubar_ml_attrib.getData() == "0") return;
  Layout l = getScriptGroup().getParentLayout();
  if (!l.isActive()) return;
  if (k == "alt+f") {
	getScriptGroup().findObject("mlFile.menu").sendAction("open", "", 0, 0, 0, 0);
	complete;
  }
  if (k == "alt+i") {
	getScriptGroup().findObject("mlView.menu").sendAction("open", "", 0, 0, 0, 0);
	complete;
  }
  if (k == "alt+h") {
	getScriptGroup().findObject("mlHelp.menu").sendAction("open", "", 0, 0, 0, 0);
	complete;
  }
}

